<!--  -->
<template>
  <div class="app-container">
    <p style="text-align: center">
      <el-radio-group v-model="reverse">
        <el-radio :label="true">时间倒序</el-radio>
        <el-radio :label="false">时间正序</el-radio>
      </el-radio-group>
    </p>
    <div style="width: 50%; margin: 0 auto">
      <el-timeline :reverse="reverse">
        <el-timeline-item
          v-for="(item, index) in loveTimeLines"
          :key="index"
          :timestamp="item.time"
          placement="top"
        >
          <el-card>
            <div slot="header">
              <el-row style="line-height: 32px">
                <el-col :span="12">
                  <b class="title">{{ item.title }}</b>
                </el-col>
                <el-col :span="12" style="text-align: right">
                  <el-tag
                    v-for="(cityItem, cityIndex) in item.cities"
                    :key="cityIndex"
                    :style="{
                      marginRight:
                        item.cities.length > 1 &&
                        index !== item.cities.length - 1
                          ? '10px'
                          : '0',
                    }"
                    type="primary"
                  >
                    {{ cityItem }}
                  </el-tag>
                  <el-tag v-if="item.hotel" type="danger">{{
                    item.hotel
                  }}</el-tag>
                </el-col>
              </el-row>
            </div>
            <div class="card-content">
              <span
                v-for="(contentItem, contentIndex) in item.content"
                :key="contentIndex"
              >
                {{ contentItem }}
              </span>
            </div>
          </el-card>
        </el-timeline-item>
      </el-timeline>
    </div>
  </div>
</template>
<script>
import SignationPad from "@/components/SignaturePad/index.vue"
import { LOVE_TIME_LINES } from "./config.js"
export default {
  components: { SignationPad },
  props: {},
  data() {
    return {
      signatureTitle: "",
      signatureFormFiled: "",
      reverse: true,
      loveTimeLines: LOVE_TIME_LINES
    }
  },
  created() {

  },
  methods: {
    handleSignaturePad(type) {
      console.log("type", type);
      if (type == 0) {
        this.signatureTitle = "检查人员签字";
        this.signatureFormFiled = "checkPersonSignature";
      }
      else {
        this.signatureTitle = "单位负责人签字";
        this.signatureFormFiled = "unitPersonChargeSignature";
      }
      console.log("signatureTitle", this.signatureTitle);
      this.$refs.refSignaturePad.show();//打开签字窗口
    },
    //确认签字
    handleConfimSign(res) {
      console.log("handleConfimSign", JSON.stringify(res));
      if (res != null) {
        const { signatureBase64, formFiled } = res;
        this.form[formFiled] = signatureBase64;//把签名的Base64给到表单
      }
      else {

      }
    },
  }
}
</script>
<style scoped>
.title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
}
.card-content {
  font-size: 16px;
  letter-spacing: 1px;
}
.el-timeline-item__timestamp {
  font-size: 18px;
  letter-spacing: 1px;
}
.el-timeline-item__timestamp.is-top {
  padding-top: unset;
}
</style>